package com.example.template.controller;

import com.example.template.bean.User;
import com.example.template.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *
 * @author xiaomin
 * @date 2018/11/5
 */

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("/getAllUser")
    @ResponseBody
    public List<User> getAllUser() {
        return userService.selectAllUsers();

    }

    @RequestMapping("/getUserById")
    @ResponseBody
    public User getUserById(@RequestParam Integer id) {
        return userService.selectUserById(id);

    }

}
